package game.gfx;

public class SpriteSheet extends ImageReader
{
	public static int spriteDimension = 8;
	
	int xPos;
	int yPos;
	int[][] tileData;
	
	int xCounter;
	int yCounter;
	
	public SpriteSheet(String path)
	{
		super(path);		
	}
	
	public int[][] getTileData(int xCoord, int yCoord)
	{
		this.xPos = xCoord * spriteDimension;
		this.yPos = yCoord * spriteDimension;
		
		int xCounter = 0;
		int yCounter = 0;
		
		tileData = new int[spriteDimension][spriteDimension];
		
		for (int y = yPos; y < (yPos + spriteDimension); y++)
		{
			for (int x = xPos; x < (xPos + spriteDimension); x++)
			{
				tileData[xCounter][yCounter] = pixelData[x][y];
				xCounter++;
			}
			xCounter = 0;
			yCounter++;
		}
		
		return tileData;
	}	
}
